<template>
  <div class="article">文章详细页
    <div class="title">{{article.title}}</div>
    <div class="add_time">{{article.add_time|dateFormat}}</div>
    <div class="content" v-html="article.content"></div>
  </div>
</template>

<script>
import {  get } from "@/utils/request1.js";
//import dayjs from 'dayjs'
export default {
  data(){
    return {
      article:{}
    }
  },
  created(){
    let {id}=this.$route.query
    console.log('query',this.$route.query)
    this.getArticleById(id);
  },
  methods:{
     async getArticleById(id){
       let params={
         id:id
       }
        let result=await get('api/article/one',params);

        console.log(result);
        this.article=result;
      }

  },
  filters:{
      //局部注册的过滤器
      // dateFormat(value){
      //   return  dayjs(value*1000).format('YYYY-MM-DD HH:mm:ss');
      // }

  }
  
  

}
</script>
  

<style>

</style>